package cn.tedu.myweb.myweb.Controller;

import java.io.FileNotFoundException;
import java.io.IOException;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.tedu.myweb.myweb.util.Url;

@ControllerAdvice
public class IControllerAdvice {
	@ResponseBody
	@ExceptionHandler
	public Url FileCatch(IOException e) {
		Url url = new Url();
		if(e instanceof FileNotFoundException) {
			
			url.setState(21);
			url.setMsg("该日期没有找到视频");
			return url;
		}else {
			url.setState(22);
			url.setMsg("未知错误");
			return url;
		}
	}
}
